package com.gack.business.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.gack.business.service.StoreSupportFacityIconServiceInterface;
import com.gack.helper.common.AjaxJson;
import com.gack.helper.common.abstractobj.ApiController;

import io.swagger.annotations.ApiOperation;

/**
 * 
* @ClassName: StoreSupportFacityIconController 
* @Description: TODO(这里用一句话描述这个类的作用) 
* @author (ZhangXinYu)  
* @date 2018年9月7日 上午10:25:34 
* @version V1.0
 */
@RestController
@RequestMapping(ApiController.STORE_SUPPORT_FACITY_ICON_URL)
public class StoreSupportFacityIconController {
	@Autowired
	private StoreSupportFacityIconServiceInterface iconService;
	
	@ApiOperation(value="编辑门店配套设施icon",notes="编辑门店配套设施icon")
	@PostMapping("edit")
	public AjaxJson edit(String backId, String id, String name, String icon){
		AjaxJson ajaxJson = new AjaxJson();
		ajaxJson.setStatus(200).setSuccess(true).setData(iconService.edit(backId, id, name, icon));
		return ajaxJson;
	}
	
	@ApiOperation(value="删除门店配套设施icon 多个id用@;-;@拼接",notes="删除门店配套设施icon 多个id用@;-;@拼接")
	@PostMapping("delete")
	public AjaxJson delete(String backId, String ids){
		AjaxJson ajaxJson = new AjaxJson();
		ajaxJson.setStatus(200).setSuccess(true).setData(iconService.delete(backId, ids));
		return ajaxJson;
	}
	
	/**
	 * 
	* @Title: search 
	* @Description: TODO(这里用一句话描述这个方法的作用) 
	* @param @param searchType
	* @param @param keyWord
	* @param @param startTime
	* @param @param endTime
	* @param @param page
	* @param @param size
	* @param @return    入参
	* @return AjaxJson    返回类型
	* @author （ZhangXinYu） 
	* @throws
	* @date 2018年9月7日 上午10:52:53 
	* @version V1.0
	 */
	@ApiOperation(value="查询门店配套设施icon",notes="查询门店配套设施icon")
	@PostMapping("search")
	public AjaxJson search(
			@RequestParam(value="searchType",defaultValue="0") int searchType,
			String keyWord, String startTime, String endTime,
			@RequestParam(value="page",defaultValue="0") int page,
			@RequestParam(value="size",defaultValue="10") int size){
		AjaxJson ajaxJson = new AjaxJson();
		ajaxJson.setStatus(200).setSuccess(true).setData(iconService.search(searchType, keyWord, startTime, endTime, page, size));
		return ajaxJson;
	}
	
	@ApiOperation(value="查询所有未被删除的门店配套设施icon",notes="查询所有未被删除的门店配套设施icon")
	@PostMapping("allIcons")
	public AjaxJson allIcons(){
		AjaxJson ajaxJson = new AjaxJson();
		ajaxJson.setStatus(200).setSuccess(true).setData(iconService.allIcons());
		return ajaxJson;
	}
}
